package com.gw.vip.server.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gw.vip.server.po.BatchClearLedger;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author GW
 * @description
 * @since 2022-05-10
 */
public interface BatchClearLedgerMapper extends BaseMapper<BatchClearLedger> {

    /**
     * 根据基础信息获取总账
     * @param capitalId
     * @return
     */
    @Select("SELECT * FROM batch_clear_ledger WHERE capital_id=#{capitalId}")
    BatchClearLedger getByBase(String capitalId);

    /**
     * 修改总账上日金额，并初始化diff_amt
     */
    @Update("UPDATE batch_clear_ledger SET last_amt = amt, diff_amt=0 WHERE last_amt<>amt")
    void updateLastAmt();
}
